home *** CD-ROM | disk | FTP | other *** search
/ All for Cell Phones: Sony Ericsson / Sony-Ericsson 2004.iso / Java / HTetris / htetris.jar / tetris / Splash.class (.txt) < prev    next >
Encoding:
Java Class File  |  2002-07-19  |  2.4 KB  |  62 lines

  1. package tetris;
  2.  
  3. import java.util.Timer;
  4. import javax.microedition.lcdui.Canvas;
  5. import javax.microedition.lcdui.Command;
  6. import javax.microedition.lcdui.CommandListener;
  7. import javax.microedition.lcdui.Display;
  8. import javax.microedition.lcdui.Displayable;
  9. import javax.microedition.lcdui.Graphics;
  10. import javax.microedition.lcdui.Image;
  11.  
  12. public class Splash extends Canvas implements CommandListener {
  13.    // $FF: renamed from: i javax.microedition.lcdui.Image
  14.    private Image field_0;
  15.    // $FF: renamed from: t java.util.Timer
  16.    Timer field_1;
  17.  
  18.    public Splash() {
  19.       try {
  20.          this.jbInit();
  21.       } catch (Exception e) {
  22.          ((Throwable)e).printStackTrace();
  23.       }
  24.  
  25.    }
  26.  
  27.    private void jbInit() throws Exception {
  28.       try {
  29.          this.field_0 = Image.createImage("/tetris/splash.png");
  30.       } catch (Exception e) {
  31.          ((Throwable)e).printStackTrace();
  32.          this.field_0 = null;
  33.       }
  34.  
  35.       ((Displayable)this).setCommandListener(this);
  36.       this.field_1 = new Timer();
  37.       this.field_1.schedule(new SplashTask(), 3000L);
  38.       ((Canvas)this).repaint();
  39.    }
  40.  
  41.    public void commandAction(Command command, Displayable displayable) {
  42.    }
  43.  
  44.    public static void back() {
  45.       Display.getDisplay(TetrisMIDlet.instance).setCurrent(TetrisMIDlet.mainMenu);
  46.    }
  47.  
  48.    protected void keyPressed(int keyCode) {
  49.       this.field_1.cancel();
  50.       back();
  51.    }
  52.  
  53.    protected void paint(Graphics g) {
  54.       g.setColor(16777215);
  55.       g.fillRect(0, 0, ((Canvas)this).getWidth(), ((Canvas)this).getHeight());
  56.       if (this.field_0 != null) {
  57.          g.drawImage(this.field_0, 0, 0, 20);
  58.       }
  59.  
  60.    }
  61. }
  62.